<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Axxx extends CI_Controller {

    function index() {

        $this->load->library('xmlrpc');

        $this->xmlrpc->server('http://www.amikom.ac.id/index.php/service/');
        $this->xmlrpc->method('login');

        $request = array(
            '09.11.2990',
            '17952'
        );
        $this->xmlrpc->set_debug(false);

        $this->xmlrpc->request($request);

        if (!$this->xmlrpc->send_request()) {
            echo $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r(json_decode(
                            $this->xmlrpc->display_response()
                    )
            );
            echo '</pre>';
        }
        $tam = json_decode($this->xmlrpc->display_response());


        echo '<br/>=========================================<br/>';
        echo $tam->name . '<br/>';
        if ($tam->status == 1) {
            echo 'Aktif<br/>';
        } else {
            echo 'Cuti<br/>';
        }
        if ($tam->alumni == 1) {
            echo 'Sudah Lulus<br/>';
        } else {
            echo 'Belum Lulus<br/>';
        }
        $foto = $tam->foto;
        echo '<img src="' . $foto . '">';

        $a = '2012-05-01';
        $b = '2012-05-01';
        $c = '2012-05-10';
        echo '<br/>a = ' . $a . '<br/>b = ';
        echo $b . '<br/>c = ';
        echo $c.'<br/>';
        if ($a<=$b && $b<=$c) {
            echo 'waktunya polling<br/>';
        } else {
            echo 'belum waktunya polling<br/>';
        }
        
        $status = $tam->status;
        $alumni = $tam->alumni;
        if ($status == 1 && $alumni == 0) {
            echo 'boleh polling<br/>';
        } else {
            echo 'tidak boleh polling<br/>';
        }
    }

}